package com.spsoft.vatoutinv.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 征税项目枚举类
 *
 * @author : chenxudong
 * @date : 2024/6/13 10:52
 */
@Getter
public enum ZsxmEnum {

    ZSXM_01("01", "销售货物"),
    ZSXM_02("02", "提供加工修理修配劳务"),
    ZSXM_03("03", "提供服务"),
    ZSXM_04("04", "销售不动产"),
    ZSXM_05("05", "销售无形资产");

    public final String key;
    public final String value;

    ZsxmEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * 根据key获取value
     */
    public static String getValueByKey(String key) {
        for (ZsxmEnum status : ZsxmEnum.values()) {
            if (status.getKey().equals(key)) {
                return status.getValue();
            }
        }
        return StringUtils.EMPTY;
    }

    /**
     * 根据value获取key
     */
    public static String getKeyByValue(String value) {
        for (ZsxmEnum status : ZsxmEnum.values()) {
            if (status.getValue().equals(value)) {
                return status.getKey();
            }
        }
        return StringUtils.EMPTY;
    }
}
